{
  "properties" : { },
  "id" : "62bfc789c19542a18995480666cafb02",
  "script" : null,
  "groupId" : "b6f6fb0fd52346bab5c701818bbf14f7",
  "name" : "查询设备日志",
  "createTime" : 1727071119127,
  "updateTime" : 1726110115124,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "syslog",
  "method" : "POST",
  "parameters" : [ {
    "name" : "current",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "Integer",
    "type" : "",
    "defaultValue" : "1",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "size",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "Integer",
    "type" : "",
    "defaultValue" : "30",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "deviceName",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "facility",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "geDate",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "leDate",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "ip",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "level",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "msg",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }, {
    "name" : "tag",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  } ],
  "options" : [ ],
  "requestBody" : "{\r\n    \"current\": 1,\r\n    \"size\": 30\r\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": {\n        \"total\": 2,\n        \"current\": 1,\n        \"size\": 30,\n        \"records\": [\n            {\n                \"id\": \"1\",\n                \"date\": \"\",\n                \"facility\": \"1\",\n                \"level\": \"1\",\n                \"host\": 1,\n                \"tag\": \"1\",\n                \"ip\": \"1.1.1.1\",\n                \"msg\": \"\",\n                \"createTime\": \"2024-08-27 02:12:22\",\n                \"deviceId\": \"D8279229554905540079\",\n                \"rowId\": \"1\",\n                \"deviceName\": \"SN_YA.DongZeGF.R\"\n            },\n            {\n                \"id\": \"2\",\n                \"date\": \"\",\n                \"facility\": \"2\",\n                \"level\": \"2\",\n                \"host\": \"2\",\n                \"tag\": \"2\",\n                \"ip\": \"2\",\n                \"msg\": \"\",\n                \"createTime\": \"2024-08-17 02:12:22\",\n                \"deviceId\": \"\",\n                \"rowId\": \"2\"\n            }\n        ]\n    }\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "current",
      "value" : "1",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "size",
      "value" : "30",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "status",
      "value" : "200",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "success",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : null,
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ {
        "name" : "total",
        "value" : "2",
        "description" : "",
        "required" : false,
        "dataType" : "Integer",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ ]
      }, {
        "name" : "current",
        "value" : "1",
        "description" : "",
        "required" : false,
        "dataType" : "Integer",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ ]
      }, {
        "name" : "size",
        "value" : "30",
        "description" : "",
        "required" : false,
        "dataType" : "Integer",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ ]
      }, {
        "name" : "records",
        "value" : "",
        "description" : "",
        "required" : false,
        "dataType" : "Array",
        "type" : null,
        "defaultValue" : null,
        "validateType" : "",
        "error" : "",
        "expression" : "",
        "children" : [ {
          "name" : "",
          "value" : "",
          "description" : "",
          "required" : false,
          "dataType" : "Object",
          "type" : null,
          "defaultValue" : null,
          "validateType" : "",
          "error" : "",
          "expression" : "",
          "children" : [ {
            "name" : "id",
            "value" : "1",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "date",
            "value" : "",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "facility",
            "value" : "1",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "level",
            "value" : "1",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "host",
            "value" : "1",
            "description" : "",
            "required" : false,
            "dataType" : "Integer",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "tag",
            "value" : "1",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "ip",
            "value" : "1.1.1.1",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "msg",
            "value" : "",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "createTime",
            "value" : "2024-08-27 02:12:22",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "deviceId",
            "value" : "D8279229554905540079",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "rowId",
            "value" : "1",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          }, {
            "name" : "deviceName",
            "value" : "SN_YA.DongZeGF.R",
            "description" : "",
            "required" : false,
            "dataType" : "String",
            "type" : null,
            "defaultValue" : null,
            "validateType" : "",
            "error" : "",
            "expression" : "",
            "children" : [ ]
          } ]
        } ]
      } ]
    } ]
  }
}
================================
  import  org.apache.commons.lang3.StringUtils;
  import log;
  var pageVO = {
     "page":body.current,
     "pageSize":body.size
  };
  var sql1="""
   SELECT
        sl.*
        FROM
        ndmp_syslog_dc sl
        where 1=1
        <if test="body.ip != null and body.ip !=''">
            AND sl.ip like concat('%', CAST(#{body.ip} AS VARCHAR) ,'%')
        </if>
        <if test="body.deviceId != null and body.deviceId !=''">
            AND sl.device_Id = #{body.deviceId}
        </if>
        <if test="body.deviceName != null and  body.deviceName !=''">
            AND sl.device_Id in (select id from ndmp_device where device_name like concat('%', CAST(#{body.deviceName} AS VARCHAR) ,'%'))
        </if>
        <if test="body.msg != null and body.msg  !=''">
            AND sl.msg like concat('%', CAST(#{body.msg} AS VARCHAR) ,'%')
        </if>
        <if test="body.geDate != null and body.geDate !=''">
            AND sl.create_time  >=  to_timestamp(#{body.geDate},'yyyy-mm-dd hh24:mi:ss')
        </if>
        <if test="body.leDate != null and body.leDate !=''">
            AND sl.create_time  <  to_timestamp(#{body.leDate},'yyyy-mm-dd hh24:mi:ss')
        </if>
        <if test="body.level != null and body.level   !=''">
            AND sl.level = #{body.level}
        </if>
        <if test="body.facility != null and body.facility  !=''">
            AND sl.facility like concat('%', CAST(#{body.facility} AS VARCHAR) ,'%')
        </if>
        <if test="body.tag != null and body.tag  !=''">
            AND sl.tag  like concat('%', CAST(#{body.tag} AS VARCHAR) ,'%')
        </if>
        order by sl.date desc
  """;
   List list = db.page(sql1,body.size,body.current-1);
   List ndmpDevices = db.table("ndmp_device").columns("id","device_name").select();
        HashMap map = new HashMap(1024);
        for ( device in ndmpDevices) {
            if(StringUtils.isBlank(device.id)){
                log.error("queryPage NdmpDevice get device_id is null!");
                continue;
            }
            map.put(device.id,device.deviceName);
        }
        if(list==null||list.records==null){
            return list;
        }
        for ( c in list.records) {
            if(StringUtils.isBlank(c.deviceId)){
                log.error("queryPage SyslogModelVo get device_id is null!");
                continue;
            }
            c.deviceName=(map.get(c.deviceId));
        }

        return list;